clear all
set maxvar 5000

cd "/Users/tg2778/Dropbox/0_Reviews_RnRs/072022_JOP_Roads/v3_JOP/Replication - Roads"
log using "4_Log/1_SummaryStats.log"

use "1_Data/AC_pre-delim_dataset.dta", clear

append using "1_Data/AC_post-delim_dataset" "1_Data/PC_pre-delim_dataset_select" "1_Data/PC_post-delim_dataset_select", generate(df) force

label var change_incumbentvoteshare "Δ incumbent voteshare"
label var totalvillconn "Δ connectivity"
label var changebjp "Δ BJP voteshare"
label var changeturnout "Δ turnout"

label values df .
label define dfvals 0 "State (Pre)" 1 "State (Post)" 2 "National (Pre)" 3 "National (Post)"
label values df dfvals

quietly estpost tabstat change_incumbentvoteshare totalvillconn changebjp changeturnout, by(df) c(stat) stat(mean sd min max n) nototal

*cd "2_Tables"

esttab using "2_Tables/B4.doc", cells("mean(fmt(3)) sd(fmt(3)) min(fmt(3)) max(fmt(3)) count(fmt(0))") nonumber nomtitle nonote noobs label legend collabels("Mean" "SD" "Min" "Max" "N") replace rtf varwidth(20) modelwidth(7 7 9 9 6)

use "1_Data/upboothdataset_1km", clear

label var changesp "Δ incumbent voteshare"
label var treatedpmgsy "PMGSY road"
label var changebjpvote "Δ BJP voteshare"
label var change_turnout "Δ turnout"

quietly estpost tabstat changesp treatedpmgsy changebjpvote change_turnout, c(stat) stat(mean sd min max n)

esttab using "2_Tables/B4.doc", cells("mean(fmt(3)) sd(fmt(3)) min(fmt(3)) max(fmt(3)) count(fmt(0))") nonumber nomtitle nonote noobs label legend collabels(none) refcat(changesp "UP Polling Data (1km buffer)", nolabel) append rtf varwidth(20) modelwidth(7 7 9 9 6)


log close
